home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxlibs / sblib / english.sb < prev    next >
Text File  |  1994-07-16  |  10KB  |  416 lines

  1. * Library for Sound Blaster control.
  2. * Compatible with Borland C++ 3.1 and up.
  3. * Other one ?may-be?
  4. * Compiled in LARGE memory model.
  5. * No recording with this BETA version.
  6.  
  7. Programmed by Jean-Francois Belleau.
  8. (C)1994.
  9.  
  10. I've spend a lot of time on this library so i hope you will appreciate.
  11. At this time it's a BETA version.
  12. Sound Blaster Pro and 16 will be available soon.
  13.  
  14. Some  message will be print on the screen. If you like the library, contact
  15. me and i will send you the latest version with no message for around 20$.
  16.  
  17. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!Important!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  18.  
  19. Use the library at your own risk.
  20.  
  21. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!Important!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  22.  
  23. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24.  
  25. Contact me for any bugs, suggestions or order via:
  26.  
  27. INTERNET:
  28.      message to    : djjf@biko.llc.org
  29.  
  30. Le Quebecois:
  31.          message to: Jean-Francois Belleau.
  32.  
  33. or  (418)837-7199.(voice).
  34.  
  35. Mailing address is:
  36.  
  37. Jean-Francois Belleau
  38. 231 des Commandeurs,
  39. Levis, PQ
  40. G6V 8A7
  41. Canada.
  42.  
  43.  
  44. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45.  
  46.  
  47.  
  48.  
  49.  
  50. Availble functions:
  51.               SB_DSP,
  52.               ~SB_DSP,
  53.               GetCradInfo,
  54.               GetCurrentStatus,
  55.               InitCard,
  56.               Set8BitsDma,
  57.               SetIOPort,
  58.               SetIrq,
  59.               SetOuputBuffer,
  60.               SetOuputRawHandle,
  61.               SetOuputVocHandle,
  62.               SetOuputWaveHandle,
  63.               SetSamplingRate,
  64.               SetUserFlag,
  65.               Start,
  66.               Stop.
  67.  
  68.  
  69.  
  70. Modules:
  71.  
  72.    -cardtype.h             Header file for card info.
  73.  
  74.    -dma8cnt.h              Header file for 8 bits DMA functions.
  75.    -dma8cnt.obj            Object code for 8 bits DMA functions.
  76.  
  77.    -dsp8.h                 Header file for low level dsp functions.
  78.    -dsp8.obj               Object code for low level dsp functions.
  79.  
  80.    -error.h                Header file for error definitions.
  81.  
  82.    -sbirq.h                Header file for IRQ functions.
  83.    -sbirq.obj              Object code for IRQ functions.
  84.  
  85.    -sbdsp.h                Header file for INTERFACE class with Sound Blaster.
  86.    -sbdsp.obj              Object code for INTERFACE class with Sound Blaster.
  87.  
  88.    -status.h               Header file for status definitions.
  89.  
  90.    -structur.h             Header file for information struct.
  91.  
  92.    -type.h                 Header file fot misc. data type.
  93.  
  94.  
  95.  
  96.  
  97.  
  98. SB_DSP:
  99. =======
  100.   Description:
  101.      Constructor for class interface.
  102.  
  103.   Entry: No parameter.
  104.  
  105.   Retunr: No return.
  106.  
  107.   Example:
  108.       SB_DSP *sbDspPTR;
  109.  
  110.       sbDspPTR = new SB_DSP;
  111.       ...
  112.       ...
  113.       ...
  114.       delete sbDspPTR;
  115.  
  116. ------------------------------------------------------------------------------
  117. GetCardInfo:
  118. ============
  119.   Description:
  120.      Return a struct of information for the current card.
  121.  
  122.      - The struct is define in structur.h
  123.  
  124.      - Never delete the pointer.
  125.  
  126.   Entry: No parameter.
  127.  
  128.   Return: *stc_CARD_INFO
  129.       A pointer on a struct.
  130.   Example:
  131.       SB_DSP *sbDspPTR;
  132.       stc_CARD_INFO *cardSTC;
  133.  
  134.       sbDspPTR = new SB_DSP;
  135.  
  136.       if( sbDspPTR->InitCard() == err_INIT_DONE )
  137.       {
  138.          cardSTC  = sbDspPTR->GetCardInfo();
  139.          printf("Card name: :%s",cardSTC->cardName);
  140.       }
  141.       delete sbDspPTR;
  142.  
  143. ------------------------------------------------------------------------------
  144. GetCurrentStatus:
  145. =================
  146.    Description:
  147.       Return the current status of the card.
  148.  
  149.    Entry: No parameter.
  150.  
  151.    Return:
  152.       sta_IDLE             : If the card is IDLE.
  153.       sta_OUTPUT_BUFFER    : If playing a buffer.
  154.       sta_OUTPUT_RAW_FILE  : If playing a raw file.
  155.       sta_OUTPUT_WAVE_FILE : If playing a wave file.
  156.       sta_OUTPUT_VOC_FILE  : If playing a voc file.
  157.  
  158.   Example:
  159.       SB_DSP *sbDspPTR;
  160.       sbDspPTR = new SB_DSP;
  161.  
  162.       if( sbDspPTR->InitCard() == err_INIT_DONE )
  163.       {
  164.          if( sbDspPTR->GetCurrentStatus() == sta_IDLE )
  165.         printf("The card is IDLE");
  166.       }
  167.       delete sbDspPTR;
  168.  
  169. ------------------------------------------------------------------------------
  170. InitCard:
  171. =========
  172.    Description:
  173.       Initialize the card.
  174.  
  175.       Important:
  176.       ----------
  177.       Use  functions SetIOPort, SetIrq, Set8BitsDma before using InitCard.
  178.  
  179.    Entry: No parameter.
  180.  
  181.    Return:
  182.       err_NO_CARD_FOUND: If no card found.
  183.       err_INIT_DONE    : If the card is correctly initialized.
  184.   Example:
  185.       SB_DSP *sbDspPTR;
  186.       sbDspPTR = new SB_DSP;
  187.  
  188.       sbDspPTR->SetIOPort(0x220);
  189.       sbDspPTR->SetIrq(5);
  190.       sbDspPTR->Set8BitsDma(1);
  191.       if( sbDspPTR->InitCard() == err_INIT_DONE )
  192.          printf("Card found");
  193.       else
  194.          printf("No Card found");
  195.  
  196.       delete sbDspPTR;
  197.  
  198. ------------------------------------------------------------------------------
  199. Set8BitsDma:
  200. ============
  201.    Description:
  202.       Select the 8 bits DMA chanel.
  203.  
  204.    Entry:
  205.      unsigned: The DMA chanel to use.
  206.  
  207.    Return:
  208.      err_INVALID_DMA   : If invalid chanel selected.
  209.      err_VALID_DMA     : If valid chanel selected.
  210.   Example:
  211.       SB_DSP *sbDspPTR;
  212.       sbDspPTR = new SB_DSP;
  213.  
  214.       if( sbDspPTR->Set8BitsDma(1) == err_VALID_DMA )
  215.          printf("Valid 8 bits DMA chanel.");
  216.       else
  217.          printf("Invalid 8 bits DMA chanel.");
  218.  
  219.       delete sbDspPTR;
  220.  
  221. ------------------------------------------------------------------------------
  222. SetIOPort:
  223. ==========
  224.    Description:
  225.       Select the IO port.
  226.  
  227.    Entry:
  228.      unsigned :The IO port to use.
  229.  
  230.    Retour:
  231.      err_INVALID_PORT  : If IO port is invalid.
  232.      err_VALID_PORT    : If IO port is valid.
  233.  
  234.    Example:
  235.       SB_DSP *sbDspPTR;
  236.       sbDspPTR = new SB_DSP;
  237.  
  238.       if( sbDspPTR->SetIOPort(0x220) == err_VALID_PORT )
  239.          printf("Valid IO Port");
  240.       else
  241.          printf("Invalid IO Port.");
  242.  
  243.       delete sbDspPTR;
  244.  
  245. ------------------------------------------------------------------------------
  246. SetIrq:
  247. =======
  248.    Description:
  249.       Select IRQ line to be use.
  250.  
  251.    Entry:
  252.      unsigned : The IRQ to use.
  253.  
  254.    RETURN:
  255.      err_INVALID_IRQ   : If IRQ is invalid.
  256.      err_VALID_IRQ     : If IRQ is valid.
  257.  
  258.    Example:
  259.       SB_DSP *sbDspPTR;
  260.       sbDspPTR = new SB_DSP;
  261.  
  262.       if( sbDspPTR->SetIrq(0x220) == err_VALID_IRQ )
  263.          printf("Valid IRQ.");
  264.       else
  265.          printf("Invalid IRQ.");
  266.  
  267.       delete sbDspPTR;
  268.  
  269. ------------------------------------------------------------------------------
  270. SetOutputBuffer:
  271. ================
  272.    Description:
  273.       Set the buffer to use for a buffer playback.
  274.       Length should be < 64k but no need to be aling.
  275.       If length > 64k use file playback.
  276.  
  277.       NB: See SetOutputVocHandle,SetOutputWaveHandle and SetOutputRawHandle
  278.       for file playback.
  279.  
  280.    Entry:
  281.      char *   : The buffer.
  282.      unsigned : The buffer length.
  283.  
  284.    Return:
  285.      err_INVALID_BUFFER: If buffer is NULL.
  286.      err_VALID_BUFFER  : If buffer is valid.
  287.  
  288.    Example:
  289.        See ex1.cpp
  290.  
  291. ------------------------------------------------------------------------------
  292. SetOutputRawHandle:
  293. ===================
  294.    Description:
  295.       Set the handle for a RAW file playback.
  296.    The file must be open with the "open" function.
  297.  
  298.    Entry:
  299.      int  : The file handle.
  300.  
  301.    Retour:
  302.      err_INVALID_HANDLE: If invalid handle.
  303.      err_VALID_HANDLE  : If valid handle.
  304.  
  305.    Example:
  306.        See ex2.cpp
  307.  
  308.  
  309. ------------------------------------------------------------------------------
  310. SetOutputVocHandle:
  311. ===================
  312.    Description:
  313.       Set the handle for a VOC file playback.
  314.       Only version 1.1 is supported for now.
  315.       The file must be open with the "open" function.
  316.  
  317.    Entry:
  318.      int : The file handle.
  319.  
  320.    Retour:
  321.      err_INVALID_HANDLE: If invalid handle.
  322.      err_VALID_HANDLE  : If valid handle.
  323.      err_NOT_SUPPORTED_FILE: If not supported file.
  324.  
  325.    Example:
  326.        See ex3.cpp
  327.  
  328. ------------------------------------------------------------------------------
  329. SetOutputWaveHandle:
  330. ====================
  331.    Description:
  332.       Set the handle for a WAVE file playback.
  333.       The file must be open with the "open" function.
  334.  
  335.    Entry:
  336.      int : The file handle.
  337.  
  338.    Retour:
  339.      err_INVALID_HANDLE: If invalid handle.
  340.      err_VALID_HANDLE  : If valid handle.
  341.      err_NOT_SUPPORTED_FILE: If not supported file.
  342.  
  343.    Example:
  344.        See ex4.cpp
  345.  
  346. ------------------------------------------------------------------------------
  347. SetSamplingRate:
  348. ================
  349.    Description:
  350.      Set the playback speed.
  351.      If the output is from a buffer or from a raw file you should use this
  352.      function to select the playback rate.
  353.      If the output is from a wave or a voc the speed is selected internaly.
  354.  
  355.  
  356.    Entry:
  357.      unsigned : The sampling rate.
  358.  
  359.    Return:
  360.        err_INVALID_RATE: If the rate is too high, it is truncate to the
  361.                  higher possible.
  362.                  If the rate is too low, it is truncate to the
  363.                  lowest possible.
  364.        err_VALID_RATE : If the rate is OK.
  365.  
  366.    Example:
  367.        See ex1.cpp
  368.  
  369. ------------------------------------------------------------------------------
  370. SetUserFlag:
  371. ============
  372.    Description:
  373.       Set a flag to indicate a playback end. The value 1 is put in the flag.
  374.  
  375.  
  376.    Entry:
  377.      unsigned *: The flag pointer.
  378.  
  379.    Return:
  380.       No return.
  381.  
  382.    Example: See ex1.cpp,ex2.cpp,ex3.cpp.
  383.  
  384. ------------------------------------------------------------------------------
  385. Start:
  386. ======
  387.    Description:
  388.       Start a play back from a file or a buffer.
  389.  
  390.    Entry: No parameter.
  391.  
  392.  
  393.    Return:
  394.       err_NO_BUFFER_SPECIFIED: If no buffer or handle specified.
  395.       err_OUTPUT_STARTED     : If playing.
  396.       err_INPUT_STARTED     : If recording.
  397.  
  398.    Example: See ex1.cpp,ex2.cpp,ex3.cpp.
  399.  
  400. ------------------------------------------------------------------------------
  401. Stop:
  402. =====
  403.    Description:
  404.      Stop the playback.
  405.  
  406.    Entry: No parameter.
  407.  
  408.  
  409.    Return:
  410.       err_NOT_STARTED   : If the card is IDLE.
  411.       err_OUTPUT_STOPPED: If output stopped.
  412.       err_INPUT_STOPPED : If recording stopped.
  413.  
  414.    Example: See ex1.cpp,ex2.cpp,ex3.cpp.
  415.  
  416. ------------------------------------------------------------------------------